package com.kh.first;

import com.kh.first.config.LoginConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@SpringBootConfiguration
public class SpringMvcConfig extends WebMvcConfigurerAdapter{

	@Autowired
	LoginConfig loginConfig;
	@Override
	public void addInterceptors(InterceptorRegistry registry) {
		registry.addInterceptor(loginConfig).addPathPatterns("/**");
	}
	@Override
    public void configurePathMatch(PathMatchConfigurer pathMatchConfigurer) {
		pathMatchConfigurer.setUseSuffixPatternMatch(false);
        pathMatchConfigurer.setUseRegisteredSuffixPatternMatch(true);
    }
	@Override
    public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
        configurer.favorPathExtension(false);
    }


}
